﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QuanLyNhaHang.GUI
{
    public partial class TKSP : Form
    {
        public TKSP()
        {
            InitializeComponent();
        }

        private void TKSP_Load(object sender, EventArgs e)
        {
            listView1.CheckBoxes = true;

            listView1.Clear(); listView1.Groups.Clear();
            listView1.ShowGroups = true;
            listView1.View = View.SmallIcon;

            listView1.Groups.Add(new ListViewGroup("Tất cả thực đơn"));
            listView1.Groups.Add(new ListViewGroup("Lẫu cá"));
            listView1.Groups.Add(new ListViewGroup("Nước có cồn"));
            listView1.Groups.Add(new ListViewGroup("Nước không cồn"));

            ListViewItem item5 = new ListViewItem("Chọn tất cả thực đơn");
            item5.Group = listView1.Groups[0]; //item.ImageIndex = 0; 
            listView1.Items.Add(item5);

            ListViewItem item = new ListViewItem("Lẫu cá chình");
            item.Group = listView1.Groups[1]; //item.ImageIndex = 0;
            listView1.Items.Add(item);

            ListViewItem item2 = new ListViewItem("Lẫu cá hanh");
            item2.Group = listView1.Groups[1];// item2.ImageIndex = 0;
            listView1.Items.Add(item2);

            ListViewItem item3 = new ListViewItem("Beer");
            item3.Group = listView1.Groups[2]; //item3.ImageIndex = 0;
            listView1.Items.Add(item3);

            ListViewItem item4 = new ListViewItem("Coca");
            item4.Group = listView1.Groups[3];// item4.ImageIndex = 0;
            listView1.Items.Add(item4);

            
        }

        private void btnTK_Click(object sender, EventArgs e)
        {
            
        }

        private void listView1_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (listView1.Items[e.Index].Text == listView1.Items[0].Text)
            {
                if (listView1.Items[e.Index].Checked == false)
                {
                    int i = 0;
                    foreach (ListViewItem item in listView1.Items)
                    {
                        if (i++ != 0)
                        {
                            item.Checked = true;
                        }
                    }
                }
                else
                {
                    int i = 0;
                    foreach (ListViewItem item in listView1.Items)
                    {
                        if (i++ != 0)
                        {
                            item.Checked = false;
                        }
                    }
                }
            }
          
        }
    }
}
